package com.dream.service.user.web.manager;

import com.dream.service.user.web.processor.RequestProcessor;
import org.springframework.beans.BeansException;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ClientManager {

    private static ClassPathXmlApplicationContext appContext;

    static {
        try {
            appContext = new ClassPathXmlApplicationContext("classpath:user-consumer.xml");
        } catch (BeansException e) {
            e.printStackTrace();
        }
    }
    public static RequestProcessor getClient(String beanname) {
        if(appContext ==null){
            return null;
        }
        return (RequestProcessor) appContext.getBean(beanname);
    }
}
